﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;

namespace HotelManagement
{
    class DbConnection
    {
        SqlConnection m_conn;
        SqlDataAdapter m_adap;
        string m_connectionString = @"Data Source=.\SQLEXPRESS;Initial Catalog=HotelManager;user=sa;password=sa";
        public DbConnection()
        {
            m_conn = new SqlConnection(m_connectionString);
            m_adap = new SqlDataAdapter();
        }
        public SqlConnection Connect()
        {
            if (m_conn.State == ConnectionState.Closed || m_conn.State == ConnectionState.Broken)
            {
                m_conn.Open();
            }
            return m_conn;
        }
        public void Close()
        {
            if (m_conn.State == ConnectionState.Open)
            {
                m_conn.Close();
            }
        }
        
    }
}
